<?php
@session_start();
echo "欢迎访问田宁的小站!";
if (!$_SESSION['pv']) {
    $_SESSION['pv'] = true;
    include($_SERVER['DOCUMENT_ROOT'] . '/static/db/connect.php');
    $reIP = $_SERVER["REMOTE_ADDR"];
    $url = 'http://ip.taobao.com/service/getIpInfo.php?ip=' . $reIP;
    $fp = file_get_contents($url);
    $data = json_decode($fp)->data;
    $city = $data->city;
    $country = $data->country;
    $sql = "insert into qt_page_view (ip, date, city, country) VALUES ('$reIP', now(), '$city', '$country')";
    $mysqli->query($sql);
    $mysqli->close();
}
?>